package com.kgc.fk.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.collection.remote.RefundApi;
import com.kgc.fk.service.RefundService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class RefundController implements RefundApi {

    private Logger logger = LoggerFactory.getLogger(RefundController.class);

    @Resource
    private RefundService refundService;


    @Override
    public ResponseMsg getRefundType() {
        logger.info("RefundController getRefundType start");
        ResponseMsg responseMsg = refundService.getRefundOrder();
        logger.info("RefundController getRefundType end result:{}", responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg getRefundPage(Map<String, Object> map) {
        logger.info("RefundController getRefundPage start param:{}", map);
        ResponseMsg responseMsg = refundService.getRefundPage(map);
        logger.info("RefundController getRefundPage end params{} result:{}", responseMsg,responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg updateRefund(Map<String, Object> map) {
        logger.info("RefundController updateRefund start param:{}", map);
        ResponseMsg responseMsg = refundService.updateRefund(map);
        logger.info("RefundController updateRefund end params{} result:{}",map, responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg addRefund(Map<String, Object> map) {
        logger.info("addRefund map:{}", map);
        ResponseMsg responseMsg = refundService.addRefund(map);
        logger.info("RefundController addRefund end prams result:{}", map,responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg getRefund(Map<String, Object> map) {
        logger.info("getRefund map:{}", map);
        ResponseMsg responseMsg = refundService.getRefundByMap(map);
        logger.info("RefundController getRefund end params{} result:{}", map,responseMsg);
        return responseMsg;
    }

    @Override
    public ResponseMsg modiRefund(Map<String, Object> map) {
        logger.info("modiRefund map:{}", map);
        ResponseMsg responseMsg = refundService.modiRefund(map);
        logger.info("RefundController modifyRefund end params{} result:{}", map,responseMsg);
        return responseMsg;
    }
}
